package jmc.skweb.core.model;

// Generated 23/09/2011 12:11:03 by Hibernate Tools 3.2.0.b9

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import jmc.skweb.util.FormatUtil;

import org.springframework.transaction.annotation.Transactional;

/**
 * ExiArt generated by hbm2java
 */
@Entity
//@Table(name = "ExiArt", schema = "ComunSql.dbo")
//Solo para Simpa Plasticos
//@Table(name = "ExiArt", schema = "ArtPlas.dbo")
@Table(name = "ExiArt", schema = "ComunSql.dbo")
public class ExiArt implements java.io.Serializable {

	private ExiArtId id;
	private Stock stock;
	private Integer nrArt;
	private Double cantidad1;
	private Double cantidad2;
	private String obser;

	public ExiArt() {
	}

	public ExiArt(ExiArtId id, Stock stock, Double cantidad1, Double cantidad2) {
		this.id = id;
		this.stock = stock;
		this.cantidad1 = cantidad1;
		this.cantidad2 = cantidad2;
	}

	public ExiArt(ExiArtId id, Stock stock, Integer nrArt, Double cantidad1,
			Double cantidad2, String obser) {
		this.id = id;
		this.stock = stock;
		this.nrArt = nrArt;
		this.cantidad1 = cantidad1;
		this.cantidad2 = cantidad2;
		this.obser = obser;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "clave", column = @Column(name = "Clave", nullable = false, length = 13)),
			@AttributeOverride(name = "nrExist", column = @Column(name = "NrExist", nullable = false)) })
	public ExiArtId getId() {
		return this.id;
	}

	public void setId(ExiArtId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "Clave", nullable = false, insertable = false, updatable = false)
	public Stock getStock() {
		return this.stock;
	}

	public void setStock(Stock stock) {
		this.stock = stock;
	}

	@Column(name = "NrArt")
	public Integer getNrArt() {
		return this.nrArt;
	}

	public void setNrArt(Integer nrArt) {
		this.nrArt = nrArt;
	}

	@Column(name = "Cantidad1", nullable = false, precision = 24, scale = 0)
	public Double getCantidad1() {
		return this.cantidad1;
	}

	public void setCantidad1(Double cantidad1) {
		this.cantidad1 = cantidad1;
	}

	@Column(name = "Cantidad2", nullable = false, precision = 24, scale = 0)
	public Double getCantidad2() {
		return this.cantidad2;
	}

	public void setCantidad2(Double cantidad2) {
		this.cantidad2 = cantidad2;
	}

	@Column(name = "Obser", length = 30)
	public String getObser() {
		return this.obser;
	}

	public void setObser(String obser) {
		this.obser = obser;
	}
	
	@Transient
	public String getSigno(){
		return FormatUtil.getSignoPorNegativoRow(this.cantidad1);
	}

}
